package com.example.zyfypt_611cgt.fragments;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.example.zyfypt_611cgt.R;
import com.example.zyfypt_611cgt.activities.LoginActivity;
import com.example.zyfypt_611cgt.activities.MyCollectActivity;

public class Fragment5 extends BaseFragment{
    private Button sc, zx;
    private TextView textView;
    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        //return super.onCreateView(inflater, container, savedInstanceState);
        return inflater.inflate(R.layout.fragment5, container, false);
    }

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        System.out.println("--fragment5--" + getSessionID());

        textView = view.findViewById(R.id.textView18);
        sc = view.findViewById(R.id.button15);
        zx = view.findViewById(R.id.button16);

        textView.setText("欢迎您，" + getUsername() + "!");

        sc.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(context, MyCollectActivity.class);
                startActivity(intent);
            }
        });

        zx.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(context, LoginActivity.class);
                getActivity().finish();
                startActivity(intent);
            }
        });

    }
}
